/**
 * PanelModuloEstudiantes.java
 */

 /**
 *  AdSec: Administrador de Secundarias
 *  Copyright (C) 2009 Daniela Ramírez Chaves (dannyrch@gmail.com)
 *  Copyright (C) 2009 Leonel Salazar Valverde (leo87sv@gmail.com)
 *
 *  This file is part of AdSec.
 *  AdSec is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  AdSec is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with AdSec.  If not, see <http://www.gnu.org/licenses/>.
 */

package adsec.presentacion;

import javax.swing.JPanel;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.text.MaskFormatter;


public class PanelModuloEstudiantes extends JPanel implements ChangeListener{

    private static final int PANEL_ESTUDIANTES = 0;
    private static final int PANEL_RESPONSABLES = 1;
    private static final int PANEL_MATRICULAR = 2;
    private static final int PANEL_REGISTRO_NOTAS = 3;
    private static final int PANEL_RECIBO = 4;
    /** Creates new form PanelEstudiantes */
    public PanelModuloEstudiantes() {
        initComponents();
        this.panelEstudiantes.iniciarPanelEstudiantes();
    }

    public void stateChanged(ChangeEvent e) {
        int i = this.tabModuloEstudiantes.getSelectedIndex();
        if (i != -1) {
            switch(i){
                case PANEL_ESTUDIANTES:
                    this.panelEstudiantes.iniciarPanelEstudiantes();
                break;
                case PANEL_RESPONSABLES:
                    this.panelResponsables.iniciarPanelResponsable();
                break;
                case PANEL_MATRICULAR:
                    this.panelEstudianteLlevaMateria.iniciarPanelEstudianteLlevaMateria();
                break;
                case PANEL_REGISTRO_NOTAS:
                    this.panelRegistroNotas.inicializarRegistroNotas();
                break;
                case PANEL_RECIBO:
                    this.panelReciboMatricula.iniciarPanelMatricula();
                break;

            }
        }
    }

    protected MaskFormatter createFormatter(String s) {
        MaskFormatter formatter = null;
        try {
            formatter = new MaskFormatter(s);
        } catch (java.text.ParseException exc) {
            System.err.println("formatter is bad: " + exc.getMessage());
            System.exit(-1);
        }
        return formatter;
    }


    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        tabModuloEstudiantes = new javax.swing.JTabbedPane();
        panelEstudiantes = new adsec.presentacion.PanelEstudiantes();
        panelResponsables = new adsec.presentacion.PanelResponsables();
        panelEstudianteLlevaMateria = new adsec.presentacion.PanelEstudianteLlevaMateria();
        panelRegistroNotas = new adsec.presentacion.PanelRegistroNotas();
        panelReciboMatricula = new adsec.presentacion.PanelReciboMatricula();

        setMaximumSize(new java.awt.Dimension(665, 770));
        setMinimumSize(new java.awt.Dimension(665, 770));
        setName("Form"); // NOI18N
        setPreferredSize(new java.awt.Dimension(665, 770));

        tabModuloEstudiantes.setAutoscrolls(true);
        tabModuloEstudiantes.setMinimumSize(new java.awt.Dimension(665, 730));
        tabModuloEstudiantes.setName("tabModuloEstudiantes"); // NOI18N
        tabModuloEstudiantes.setPreferredSize(new java.awt.Dimension(665, 730));

        panelEstudiantes.setMinimumSize(new java.awt.Dimension(665, 670));
        panelEstudiantes.setName("panelEstudiantes"); // NOI18N
        panelEstudiantes.setPreferredSize(new java.awt.Dimension(665, 670));
        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(adsec.presentacion.LiceoEscazuApp.class).getContext().getResourceMap(PanelModuloEstudiantes.class);
        tabModuloEstudiantes.addTab(resourceMap.getString("panelEstudiantes.TabConstraints.tabTitle"), panelEstudiantes); // NOI18N

        panelResponsables.setName("panelResponsables"); // NOI18N
        tabModuloEstudiantes.addTab(resourceMap.getString("panelResponsables.TabConstraints.tabTitle"), panelResponsables); // NOI18N

        panelEstudianteLlevaMateria.setName("panelEstudianteLlevaMateria"); // NOI18N
        tabModuloEstudiantes.addTab(resourceMap.getString("panelEstudianteLlevaMateria.TabConstraints.tabTitle"), panelEstudianteLlevaMateria); // NOI18N

        panelRegistroNotas.setName("panelRegistroNotas"); // NOI18N
        tabModuloEstudiantes.addTab(resourceMap.getString("panelRegistroNotas.TabConstraints.tabTitle"), panelRegistroNotas); // NOI18N

        panelReciboMatricula.setName("panelReciboMatricula"); // NOI18N
        tabModuloEstudiantes.addTab(resourceMap.getString("panelReciboMatricula.TabConstraints.tabTitle"), panelReciboMatricula); // NOI18N

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(tabModuloEstudiantes, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(tabModuloEstudiantes, javax.swing.GroupLayout.DEFAULT_SIZE, 770, Short.MAX_VALUE)
        );

        this.tabModuloEstudiantes.addChangeListener(this);
    }// </editor-fold>//GEN-END:initComponents


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private adsec.presentacion.PanelEstudianteLlevaMateria panelEstudianteLlevaMateria;
    private adsec.presentacion.PanelEstudiantes panelEstudiantes;
    private adsec.presentacion.PanelReciboMatricula panelReciboMatricula;
    private adsec.presentacion.PanelRegistroNotas panelRegistroNotas;
    private adsec.presentacion.PanelResponsables panelResponsables;
    private javax.swing.JTabbedPane tabModuloEstudiantes;
    // End of variables declaration//GEN-END:variables

}
